#include "soapWebService1SoapProxy.h"
#include "WebService1Soap.nsmap"
#include <cstdlib>
#include <fstream>

using std::cout;
using std::endl;
using std::cerr;

int main() 
{
    WebService1SoapProxy proxy(SOAP_C_UTFSTRING);
    std::string lottery("FCSSLData_SH");
    _ns1__PresentInformationResponse infoResp;
    //int ret_code = proxy.PresentInformation(NULL, &infoResp);
    int ret_code = 0;
    cout<<SOAP_OK<<endl;
    if(ret_code == SOAP_OK)
    {
        //cout<<*infoResp.PresentInformationResult<<endl;
    }


    _ns1__PresentList pList;
    std::string lType("全国开奖");
    pList.type = &lType;
    _ns1__PresentListResponse listResp;

    //ret_code = proxy.PresentList(&pList,  &listResp);
    ret_code = 0;
    if(ret_code == SOAP_OK)
    {
        //std::string result = *listResp.PresentListResult;
        cout<<"list"<<endl;
        //cout<< result <<endl;
    }
    else
    {
        cerr<<"call failed"<<endl;
        cerr<<proxy.errnum<<endl;
        cerr<<proxy.soap_fault_string()<<endl;
        cerr<<proxy.soap_fault_detail()<<endl;
    }
    
    std::string pageIndex("1");
    std::string name("上海时时乐");
    std::string nullString("");
    std::string zeroString("0");
    _ns1__Present3DList p3DList;
    p3DList.pageindex = &pageIndex;
    p3DList.lottory = &lottery;
    p3DList.pl3 = &nullString; 
    p3DList.name = &name;
    p3DList.isgp = &zeroString;

    _ns1__Present3DListResponse p3DResponse;
    ret_code = proxy.Present3DList(&p3DList, &p3DResponse);
    cout<<ret_code<<endl;
    if(ret_code == SOAP_OK)
    {
        cout<<"success"<<endl;
        std::string result = *p3DResponse.Present3DListResult;
        cout<<result<<endl;
        std::ofstream testfile("result.txt");
        testfile<<result<<endl;
        testfile.close();
    }
    else
    {
        cerr<<"call failed"<<endl;
        cerr<<proxy.errnum<<endl;
        cerr<<proxy.soap_fault_string()<<endl;
        cerr<<proxy.soap_fault_detail()<<endl;
    }

    return 0;
}   
